package com.business.business.web.web;

import cn.hutool.json.JSONObject;
import com.business.business.common.base.BaseController;
import com.business.business.support.annotaion.Action;
import com.business.business.support.model.RespEntity;
import com.business.business.web.service.MiniFirestationService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * @Author xulumin
 * @Date 2024/3/20 16:39
 * @Version 1.0
 * @Desc 微型消防站控制器
 */
@Controller
@Action
@RequestMapping(value = "miniFirestation")
public class MiniFirestationController extends BaseController {

    @Resource
    private MiniFirestationService miniFirestationService;

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 微型消防站新增或者更新
     */
    @PostMapping("addOrUpdateFirestation")
    public RespEntity addOrUpdateFirestation(@RequestBody(required = false) JSONObject jsonObject) throws IllegalAccessException, InstantiationException {
        return miniFirestationService.addOrUpdateFirestation(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 微型消防站信息列表
     */
    @GetMapping("getFirestationList")
    public RespEntity getFirestationList(@RequestBody(required = false) JSONObject jsonObject) {
        return miniFirestationService.getFirestationList(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/20
     * Description: 获取微型消防站
     */
    @GetMapping("getFirestationInfo")
    public RespEntity getFirestationInfo(@RequestBody(required = false) JSONObject jsonObject) {
        return miniFirestationService.getFirestationInfo(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 删除微型消防站
     */
    @PostMapping("delFirestation")
    public RespEntity delFirestation(@RequestBody(required = false) JSONObject jsonObject) {
        return miniFirestationService.delFirestation(jsonObject);
    }
}
